<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateTbAnchorTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        // Schema::create('tb_anchor', function (Blueprint $table) {
        //     $table->bigIncrements('id');
        //     $table->datetimes();
        // });
        if (!Schema::hasTable('tb_anchor')) {
            \Hyperf\DbConnection\Db::select("CREATE TABLE `tb_anchor` (
  `uid` int unsigned NOT NULL COMMENT '主播id，即user表里id',
  `accept_video` tinyint unsigned DEFAULT '1' COMMENT '0:不接收视频 1:接受视频',
  `accept_audio` tinyint unsigned DEFAULT '1' COMMENT '0:不接收语音 1:接受语音',
  `call_video_time` int unsigned DEFAULT '0' COMMENT '上次主动发起视频聊天请求的时间',
  `call_audio_time` int unsigned DEFAULT '0' COMMENT '上次主动发起语音聊天请求的时间',
  `greet_time` int unsigned DEFAULT '0' COMMENT '上次主动打招呼的时间',
  `video_price` int unsigned DEFAULT '50' COMMENT '每分钟视频通话价格，必须是整十,最小为10金币',
  `audio_price` int unsigned DEFAULT '5' COMMENT '每分钟音频通话价格，必须是整十,最小为10金币',
  `greet_price` int unsigned DEFAULT '0' COMMENT '打招呼文字聊天价格，比如1金币/用户回复',
  `wx_price` int unsigned DEFAULT '0' COMMENT '微信价格(金币)',
  `qq_price` int unsigned DEFAULT '0' COMMENT 'qq查看价格(废弃)',
  `ctime` int unsigned DEFAULT '0' COMMENT '签约时间',
  `rate` decimal(10,2) unsigned DEFAULT '0.40' COMMENT '女主播提成比例',
  `force_vip` tinyint DEFAULT '0' COMMENT '聊天时必需开通会员 0否 1是',
  `alipay_id_status` tinyint DEFAULT '0' COMMENT '支付宝账号审核状态 0未绑定 1正常 2审核中 3未通过',
  `alipay_id_check_remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '支付宝审核备注',
  `status` tinyint unsigned DEFAULT '0' COMMENT '0:正常，1封禁, 2永久封禁',
  `real_name` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '姓名',
  `guild_num` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '公会号',
  `operate_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '运营人员（有公会的默认公会运营）',
  `bind_guild_time` int NOT NULL DEFAULT '0',
  `star_rank` tinyint NOT NULL DEFAULT '1',
  `auto_reply_status` tinyint DEFAULT '0' COMMENT '聊天托管',
  `video_url` varchar(256) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '小视频',
  `call_show` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '通话封面视频或图片地址',
  `call_show_type` tinyint(1) DEFAULT '0' COMMENT '封面类型 1视频 2图片',
  `connection_num` int DEFAULT '80',
  `connection_time` int DEFAULT '20' COMMENT '接通时长',
  `connection_rate` tinyint DEFAULT '85' COMMENT '通话率',
  `score_sort` decimal(10,2) DEFAULT NULL COMMENT '排序分',
  `score_origin` decimal(10,2) DEFAULT '10.00' COMMENT '初始分',
  `score_origin_2` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '0',
  `score_income` decimal(11,2) DEFAULT NULL COMMENT '收益分',
  `score_star` decimal(11,2) DEFAULT '10.00' COMMENT '星级分',
  `score_mes` decimal(10,2) DEFAULT NULL COMMENT '私信回复分',
  `score_duration` decimal(11,2) DEFAULT NULL COMMENT '时长分',
  `score_calling_num` decimal(11,2) DEFAULT NULL COMMENT '主叫接通数分',
  `score_called_num` decimal(11,2) DEFAULT NULL COMMENT '被动接通数分',
  `audio_greeting_url` varchar(256) CHARACTER SET utf8mb3 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `audio_greeting_status` tinyint NOT NULL DEFAULT '0',
  `audio_greeting_update` int NOT NULL DEFAULT '0',
  `audio_greeting_len` int NOT NULL DEFAULT '0',
  `status_time` int DEFAULT '0' COMMENT '审核时间',
  `recommend` int DEFAULT '0' COMMENT '推荐 数字越大越靠前',
  `unblock_time` int DEFAULT '0' COMMENT '解封时间',
  `wx_status` tinyint DEFAULT '0' COMMENT '状态 0未审核 1审核通过 2审核不通过',
  `wx_content` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '微信审核原因',
  `wx_new` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '当前审核微信号',
  `wx_check_time` int DEFAULT '0' COMMENT '微信审核时间',
  `wx_old` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '上次审核通过的微信号',
  `wx_old_price` int DEFAULT '0' COMMENT '上次审核通过的微信号价格',
  `qq_status` tinyint DEFAULT '0' COMMENT 'QQ状态：0未审核 1审核通过 2审核不通过',
  `qq_content` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT 'QQ审核原因',
  `qq_new` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '',
  `evaluate` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '最多标签',
  `evaluate_color` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '标签颜色',
  `bank_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '银行名称',
  `bank_code` int DEFAULT '0' COMMENT '银行代码',
  `bank_num` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '银行卡账号',
  `bank_address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '开户行',
  `bank_address_code` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '开户行代码',
  `bank_province` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '开户省',
  `bank_city` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '开户市',
  `bank_area` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '地区',
  `bank_num_check_status` tinyint DEFAULT '0' COMMENT '提现账号审核状态 0账号未绑定 1正常 2审核中 3未通过',
  `bank_num_check_remark` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '提现账号审核备注',
  `alipay_id` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '支付宝提现账号',
  `guard_gold` int DEFAULT '0' COMMENT '守护金币',
  `work` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '职业',
  `emotion` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '情感',
  `agreement_url` varchar(150) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '协议图片地址',
  `is_submit` tinyint DEFAULT '0' COMMENT '是否提交协议：  0否 1是',
  `is_down` tinyint DEFAULT '0' COMMENT '是否下载 0否 1是',
  `first_level` enum('S','A') CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT 'A' COMMENT '认证等级',
  `star_level` int DEFAULT '0' COMMENT '星级（0-14）',
  `is_inside` tinyint unsigned DEFAULT '0' COMMENT '是否在固定名单 0：不在 1：在',
  `is_insideS` tinyint(1) DEFAULT '0' COMMENT '名单2 (针对当前金币小于9的用户)',
  `update_time` datetime DEFAULT NULL,
  `audit_uid` int unsigned DEFAULT NULL,
  `audit_time` datetime DEFAULT NULL,
  `content` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL,
  `teamwork` tinyint DEFAULT '0' COMMENT '是否特定合作主播 0否 1是',
  `teamwork_times` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '' COMMENT '合作主播工作时间段',
  `settle_type` tinyint DEFAULT '0' COMMENT '结算方式 0未设置 1自主提现（默认） 2结算到公会（每周）',
  `privilege_pay_notify` tinyint(1) DEFAULT '0' COMMENT '充值消息提醒',
  `privilege_auto_chat` tinyint(1) DEFAULT '0' COMMENT '群发快捷用户',
  `privilege_show_balance` tinyint(1) DEFAULT '0' COMMENT '显示对方余额',
  `one_click_greet` tinyint(1) DEFAULT '1' COMMENT '一键打招呼',
  `is_send_gift` tinyint(1) DEFAULT '0' COMMENT '是否可以发送礼物',
  `send_gift_rate` decimal(10,2) DEFAULT NULL COMMENT '送礼折扣',
  `spread_rate` int DEFAULT '10' COMMENT '推广分成比例 \r\n15(人数）—10%（主播收益）\r\n16-50(人数）—15%（主播收益）\r\n51-99(人数）—20%（主播收益）\r\n100+(人数）—30%（主播收益）',
  `in_package` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT '0' COMMENT '在展示APP',
  `appear_level` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '颜值等级',
  `wx_audio_uid` int unsigned DEFAULT '0' COMMENT '微信审核人',
  PRIMARY KEY (`uid`) USING BTREE,
  KEY `idx_tb_anchor_update_time` (`update_time`) USING BTREE,
  KEY `idx_ctime` (`ctime`) USING BTREE,
  KEY `idx_status` (`status`) USING BTREE,
  KEY `idx_first_level` (`first_level`) USING BTREE,
  KEY `idx_score_origin` (`score_origin`) USING BTREE,
  KEY `idx_score_fresh` (`score_duration`) USING BTREE,
  KEY `idx_score_income` (`score_income`) USING BTREE,
  KEY `idx_score_star` (`score_star`) USING BTREE,
  KEY `idx_score_mes` (`score_mes`) USING BTREE,
  KEY `idx_guildnum` (`guild_num`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;");
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('tb_anchor');
    }
}
